From: Jonas Dreßler Date: Sun, 27 Oct 2019 17:58:16 +0000 (+0100) Subject: closeDialog: Actually set key focus to button when grabbing key focus X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~77 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=de834fe3073c3eafb3fe7feff42d6107f91f1e79;p=gnome-shell.git closeDialog: Actually set key focus to button when grabbing key focus When setting the key focus to `this._dialog`, the default button is not automatically focused and no button has key focus. Use the `initialKeyFocus` property of the dialog instead, and set focus to the default button if the dialog is not already focused. Part-of: --- diff --git a/js/ui/closeDialog.js b/js/ui/closeDialog.js index b3b8d4cf3..a0857298e 100644 --- a/js/ui/closeDialog.js +++ b/js/ui/closeDialog.js @@ -208,7 +208,11 @@ export const CloseDialog = GObject.registerClass({ } vfunc_focus() { - if (this._dialog) - this._dialog.grab_key_focus(); + if (!this._dialog) + return; + + const keyFocus = global.stage.key_focus; + if (!keyFocus || !this._dialog.contains(keyFocus)) + this._dialog.initialKeyFocus.grab_key_focus(); } });